package data;

public class GameRule {
    public static boolean isConnect(
            int[][] data,int row1,int col1,int row2,int col2){
        if (col1==col2&&data[row1][col1]==data[row2][col2]){
            int col=col1;
            int sum=0;
            if (row1>row2){
                int t=row1;
                row1=row2;
                row2=t;
            }
            for (int row=row1+1;row<row2;row++){
                sum+=data[row][col];
            }
            if (sum==0){
                return true;
            }
        }
        return false;
    }

}
